﻿import QtQuick 2.15
import QtMultimedia 5.15

Image {
    id: videoImage
    width:parent.width
    height:parent.height
    fillMode: Image.PreserveAspectFit
    source: "image://videoprovider/frame"
    onStatusChanged: {
            if (status == Image.Error) {
                console.error("Failed to load video frame");
                source = "placeholder.png"; // 回退到占位图
            }
    }

    // 强制定期更新
    Timer {
        interval: 33 // ~30fps
        running: true
        repeat: true
        onTriggered: {
            if(videoController.isPlay()){
                videoImage.source = ""
                videoImage.source = "image://videoprovider/frame?" + Math.random()
            }
        }
    }
}
